//
//  HESignView.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/12/10.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HESignView.h"

@interface HESignView ()

@property (nonatomic, strong) UIImageView *dateView;
@property (nonatomic, strong) UILabel *scroeLb;
@property (nonatomic, strong) UILabel *dateLb;

@end

@implementation HESignView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = KWhiteColor;
        [self initUI];
    }
    return self;
}

- (void)initUI {
    UIImageView *dateView = [UIImageView new];
    dateView.image = IMAGE_NAMED(@"my_unsign");
    [self addSubview:dateView];
    _dateView = dateView;
    
    UILabel *scroeLb = [UILabel new];
    scroeLb.text = @" ";
    scroeLb.font = DYBlodFont(15);
    scroeLb.textAlignment = NSTextAlignmentCenter;
    scroeLb.textColor = CNavDargGrayColor;
    [dateView addSubview:scroeLb];
    _scroeLb = scroeLb;
    
    UILabel *dateLb = [UILabel new];
    dateLb.text = @"-";
    dateLb.font = DYFont(14);
    dateLb.textColor = CNavLightBlackColor;
    dateLb.textAlignment = NSTextAlignmentCenter;
    [self addSubview:dateLb];
    _dateLb = dateLb;
    
    [dateView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(0);
        make.width.height.equalTo(self.mas_width);
    }];
    
    [scroeLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(dateView);
        make.right.left.equalTo(dateView);
        make.bottom.equalTo(dateView);
    }];
    
    [dateLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(dateView.mas_bottom).offset(10);
        make.right.left.equalTo(self);
        make.bottom.equalTo(self);
    }];
}

- (void)setModel:(HESignDayModel *)model {
    _dateLb.text = model.day;
    _scroeLb.text = model.pointValue;
    if (model.isSign) {
        _dateView.image = IMAGE_NAMED(@"my_signed");
        _scroeLb.hidden = YES;
    }else {
        _dateView.image = IMAGE_NAMED(@"my_unsign");
        _scroeLb.hidden = NO;
    }
}
 

@end
